package tree;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import ui.EditorFrame;

public class ProjectTreeSelectionListener extends MouseAdapter {

	//主界面的frame
	private EditorFrame editorFrame;
	
	public ProjectTreeSelectionListener(EditorFrame editorFrame){
		this.editorFrame = editorFrame;
	}
	
	public void mousePressed(MouseEvent e){
		//得到选择的节点
		ProjectTreeNode selectNode = this.editorFrame.getSelectNode();
		if(selectNode==null){
			return;
		}
		if(selectNode.getFile().isDirectory()){
			return;
		}
		//打开文件
		this.editorFrame.openFile(selectNode.getFile());
	}
}
